#!/usr/bin/perl

@langtags = ("JA","EN");

$lang=$ARGV[0];

shift;

while(<>) {

    $bm = 0;
    $em = 0;
    if (/\/\/\/$lang/) {
	s/\/\/\/$lang.*$//g;
    }
    s/\<$lang\>.*\<\/$lang\>//g;
    if (/\<\/$lang\>/) {
	s/^.*\<\/$lang\>//g;
	$em = 1;
	$mode = 0;
    }
    if (/\<$lang\>/) {
	s/\<$lang\>.*$//g;
	$bm = 1;
	$mode = 1;
    }
    if ($em == 0 && $bm == 0) {
	if ($mode == 1) {
	    print "\n";
	    next;
	}
    }
    foreach $i (@langtags) {
	s/\<\/?$i\>//g;
    }
    print;
}
